/*
 * @(#) UlynlistTest.js
 *
 * <br> Copyright:  Copyright (c) 2017
 * <br>
 * <br> @author caijinhuang
 * <br> 2017-12-21 15:15:36
 */

import React from 'react';
import $ from 'jquery';
import 'art-template';
import '@share/ulynlist/ulynlist';
import '@share/ulynlist/ulynlist.table';
import '@share/ulynlist/ulynlist.pagebar';
import '@share/ulynlist-ext';


class UlynlistTest extends React.Component{

    baseUrl_  = "http://localhost/sharemeeting";
    constructor(){
        super();
    }

    componentDidMount(){
        let opts = {
            basePath: "node_modules/@share/ulynlist-ext",
            tableTpl:"share",
            tableColumn:{
                title:'ulynlist',
                rememberCheckbox:true,
                keyColumn:"",
                columns:[
                    {field:'CHECKED',checkbox:'ID',className:"sortable",width:"40px",style:"width:40px;"},
                    {field:'bdcr',overflowview:'ellipsis',label:'姓名',className:"unSortable",
                        tableTransFunc:function(value,item){
                            return '<a class="table_do_a btn_view" href="javascript:void(0)">链接使用</a>'/*0077bb*/
                        }
                    },
                    {field:'wtdw',overflowview:'normal',label:'性别',className:"sortable"},
                    {field:'wtrq',overflowview:'normal',label:'委托日期',className:"unSortable",trans: 'toDisDate',width:"120px"},
                    {field:'gssq',overflowview:'normal',label:'归属社区',className:"unSortable"},
                    {field:'dcdw',overflowview:'normal',label:'状态',className:"unSortable",
                        tableTransFunc:function(value,item){
                            if(value =="01"){
                                return '<span><i class="fa fa-clock-o"></i>待审核</span>'
                            }
                            if(value =="02"){
                                return '<span class="text-success"><i class="fa fa-check-circle"></i>审核通过</span>'
                            }
                            if(value =="03"){
                                return '<span class="text-danger"><i class="fa fa-times-circle"></i>审核不通过</span>'
                            }
                        }
                    },
                    {field:'wczt',overflowview:'normal',label:'完成状态',className:"unSortable"},
                    {field: 'gssq', label: '操作', style: "text-align:left", className: "sortable",width:"120",
                        tableTransFunc:function(value,item){
                            return '<a class="table_do_a btn_view toDetail" href="javascript:void(0)">查看</a>' +
                                   '<a class="table_do_a btn_del deleteItem" href="javascript:void(0)">删除</a>'
                        }
                    }
                ],
                rownumbers:false,
            },
            customData:[
                {"state":"success","wtrq":"2016-06-06","dcdw":"01","bdcr":"占山","gssq":"新林社区","wtdw":"男","wczt":'司法所调查已完成',"ID":'01'},
                {"state":"info","wtrq":"2016-06-07","dcdw":"02","bdcr":"占山","gssq":"新林社区","wtdw":"女","wczt":'司法所调查已完成',"ID":'02'},
                {"state":"danger","wtrq":"2016-06-08","dcdw":"01","bdcr":"占山","gssq":"新林社区","wtdw":"男","wczt":'司法所调查已完成',"ID":'05'},
                {"state":"warning","wtrq":"2016-06-06","dcdw":"02","bdcr":"占山","gssq":"新林社区","wtdw":"男","wczt":'司法所调查已完成',"ID":'04'},
                {"wtrq":"2016-06-06","dcdw":"03","bdcr":"占山","gssq":"新林社区","wtdw":"男","wczt":'司法所调查已完成',"ID":'03'},
                {"wtrq":"2016-06-06","dcdw":"03","bdcr":"占山","gssq":"新林社区","wtdw":"男","wczt":'司法所调查已完成',"ID":'05'},
                {"wtrq":"2016-06-06","dcdw":"03","bdcr":"占山","gssq":"新林社区","wtdw":"男","wczt":'司法所调查已完成',"ID":'06'},
                {"wtrq":"2016-06-06","dcdw":"03","bdcr":"占山","gssq":"新林社区","wtdw":"男","wczt":'司法所调查已完成',"ID":'07'},
                {"wtrq":"2016-06-06","dcdw":"03","bdcr":"占山","gssq":"新林社区","wtdw":"男","wczt":'司法所调查已完成',"ID":'08'},
                {"wtrq":"2016-06-06","dcdw":"03","bdcr":"占山","gssq":"新林社区","wtdw":"男","wczt":'司法所调查已完成',"ID":'09'},
                {"wtrq":"2016-06-06","dcdw":"03","bdcr":"占山","gssq":"新林社区","wtdw":"男","wczt":'司法所调查已完成',"ID":'11'},
                {"wtrq":"2016-06-06","dcdw":"01","bdcr":"占山","gssq":"新林社区","wtdw":"男","wczt":'司法所调查已完成',"ID":'010'}
            ],
            extra:{
                linesPerPageEditable:true,
                tableSize:'',/*默认值为default，配置值支持 sm*/
                lineStyle:'lineSpace'/*默认值为default，配置值支持 lineSpace(各行变色)*/
            },
            requestData:{linesPerPage:10},
            pageBarId: 'js-tablePageBar',
            pageBarTpl:"share"
        };
        $("#ulyn-table-id").ulynlist(opts);
    }


    render(){
        return (
            <div>
                <div id="ulyn-table-id"/>
                <div id="ulyn-pageBar-id"/>
            </div>
        );
    }

}

export default UlynlistTest

